<!DOCTYPE html>
<html class="no-js" lang="zxx">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
    <title>Manage Resumes - JobGrids Job Portal HTML Template.</title>
    <meta name="description" content="" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="shortcut icon" type="image/x-icon" href="assets/images/favicon.svg" />
    <!-- Place favicon.ico in the root directory -->

    <!-- Web Font -->
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
        rel="stylesheet">

    <!-- ========================= CSS here ========================= -->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css" />
    <link rel="stylesheet" href="assets/css/LineIcons.2.0.css" />
    <link rel="stylesheet" href="assets/css/animate.css" />
    <link rel="stylesheet" href="assets/css/tiny-slider.css" />
    <link rel="stylesheet" href="assets/css/glightbox.min.css" />
    <link rel="stylesheet" href="assets/css/main.css" />

</head>

<body>
    <!--[if lte IE 9]>
      <p class="browserupgrade">
        You are using an <strong>outdated</strong> browser. Please
        <a href="https://browsehappy.com/">upgrade your browser</a> to improve
        your experience and security.
      </p>
    <![endif]-->

    <div id="loading-area"></div>

    <!-- Start Header Area -->
    <header class="header">
      <div class="navbar-area">
        <div class="container">

          <div class="row align-items-center">

            <div class="col-lg-12">
              <nav class="navbar navbar-expand-lg">
                <a class="navbar-brand logo" href="index-hr.html">
                  <img class="logo1" src="assets/images/logo/logo.svg" alt="Logo" />
                </a>
                <button class="navbar-toggler" type="button" data-toggle="collapse"
                        data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                  <span class="toggler-icon"></span>
                  <span class="toggler-icon"></span>
                  <span class="toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse sub-menu-bar" id="navbarSupportedContent">
                  <ul id="nav" class="navbar-nav ml-auto">
                    <li class="nav-item">
                      <a  href="index-hr.html">主页</a>
                    </li>



                    <li class="nav-item">
                      <a  href="browse-jobs.html">职位搜索</a>
                    </li>

                    <li class="nav-item active" ><a href="#"class="active">职位管理 </a>
                      <ul class="sub-menu">
                        <li><a  href="post-job.html">发布职位</a></li>
                        <li><a href="manage-jobs.html">职位查看与编辑</a></li>
                        <li><a   href="have-manage-resumes.html">已处理申请</a></li>
                        <li><a class="active" href="manage-resumes.html">待处理申请</a></li>

                      </ul>
                    </li>



                    <li class="nav-item">
                      <a href="blog-grid-sidebar.html">论坛</a></li>
                    </li>

                    <li class="nav-item"><a href="contact.html">联系我们 </a> </li>


                    <li class="nav-item"><a href="#">其他</a>
                      <ul class="sub-menu">
                        <!-- <li><a href="index.html" onclick="logout()">Log Out</a></li> -->
                        <li><a onclick="checkloginuser()">Personal Info</a></li>
                        <li><a href="about-us.html" onclick="addtoken()">About Us</a></li>
                        <li><a href="job-list.html">Job List</a></li>
                        <li><a href="job-details.html">Job Details</a></li>
                        <li><a href="resume.html">Resume Page</a></li>
                        <li><a href="privacy-policy.html">Privacy Policy</a></li>
                        <li><a href="faq.html">Faq</a></li>
                        <li><a href="pricing.html">Our Pricing</a></li>
                        <li><a href="404.html">404 Error</a></li>
                        <li><a href="mail-success.html">Mail Success</a></li>
                      </ul>
                    </li>

                    <li class="nav-item">
                      <a href="#">个人中心</a>
                      <ul class="sub-menu">
                        <li><a href="showhrinfo.html">信息编辑</a></li>

                        <li><a href="job-alerts.html">消息提醒</a></li>
                        <li><a href="manage-blog.html">管理博客</a></li>
                      </ul>
                    </li>
                    <li class="nav-item login">

                      <a href="showhrinfo.html" id="shownameid" >
                      </a>
                      <ul class="sub-menu">
                        <li><a href="index.html" onclick="logout()">退出登录</a></li>
                      </ul>
                    </li>
                  </ul>
                </div>
                <!-- navbar collapse -->
                <!--登录显示用户名的地方，点击进入到个人中心界面-->



              </nav>
              <!-- navbar -->
            </div>
          </div>
          <!-- row -->
        </div>
        <!-- container -->
      </div>
      <!-- navbar area -->
    </header>
    <!-- End Header Area -->


    <!-- Main Content Start -->
    <div class="manage-resumes section">
        <div class="container">
            <div class="resume-inner">
                <div class="row">
                    <!-- Start Main Content -->
                    <div class="col-lg-4 col-12">
                        <div class="dashbord-sidebar">
                            <ul>
                                <li class="heading">职位管理</li>
                                <!-- <li><a href="resume.html"><i class="lni lni-clipboard"></i> My Resume</a></li> -->
                                <li><a  href="post-job.html"><i class="lni lni-briefcase"></i> 发布职位</a></li>

                                <li><a href="manage-jobs.html"><i class="lni lni-briefcase"></i> 职位查看与编辑</a></li>
                                <li><a href="have-manage-resumes.html"><i class="lni lni-upload"></i> 已处理申请</a></li>
                                <li><a  class="active"  href="manage-resumes.html"><i class="lni lni-envelope"></i> 待处理申请</a></li>
                                <!-- <li><a href="hr_manage-applications.html"><i class="lni lni-bookmark"></i> 职位查看 </a></li> -->
                                <li><a href="notifications.html"><i class="lni lni-alarm"></i> 消息提醒 <span
                                            class="notifi">5</span></a></li>

                                <!-- <li><a href="change-password.html"><i class="lni lni-lock"></i> Change Password</a></li>
                                <li><a href="index.html"><i class="lni lni-upload"></i> Sing Out</a></li> -->
                            </ul>
                        </div>
                    </div>



                    <!-- End Main Content -->
                    <div class="col-lg-8 col-12">

                    <!-- 基本信息开始-->
                    <div class="row">
                        <div class="col-lg-6 col-12">
                            <div class="form-group">
                            <input id="seekerbasicid1" name="seekerbid" style="display:none">
                            <label class="control-label">申请职位</label>
                            <select required id="seekerdetailname" name="seekername" class="form-control">
                              <option value="">请选择职位</option>
                          </select>
                          </div>
                        </div>
                        <div class="col-lg-6 col-12">
                            <div class="form-group">
                            <label class="control-label">申请人信息</label>
                            <input required id="seekerdetailinfo" name="seekertel"type="text" class="form-control" placeholder="姓名">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-lg-6 col-12">
                            <div class="form-group">
                            <input id="seekerbasicid" name="seekerbid" style="display:none">
                            <label class="control-label">教育经历</label>
                            <input required id="seekerdetailedu" name="seekername"type="text" class="form-control" placeholder="院校...">
                            </div>
                        </div>
                        <div class="col-lg-6 col-12">
                            <div class="form-group">
                            <label class="control-label">申请人优势</label>
                            <input required id="seekerdetailadv" name="seekertel"type="text" class="form-control" placeholder="技能...">
                            </div>
                        </div>
                    </div>
                    <br>
                    <div class="form-group mb-8 button  text-right">
                        <button class="btn " id="searchseeker" >搜索
                        </button>
                      </div>
                      <br>

                        <div class="inner-content">


                          <div class="managejobnotyet-content">
                            <div class="row align-items-center justify-content-center jobnotyet-list">
                           <!--动态渲染内容插在这里面-->

                            </div>
                          </div>

                        </div>
                        <!-- Pagination -->
                        <div class="pagination left pagination-md-center">
                          <ul class="pagination-list"></ul>
                        </div>
                        <!-- End Pagination -->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- Main Content end -->

    <!-- Login Modal -->
    <div class="modal fade form-modal" id="login" tabindex="-1" aria-hidden="true">
      <div class="modal-dialog max-width-px-840 position-relative">
        <button type="button"
                class="circle-32 btn-reset bg-white pos-abs-tr mt-md-n6 mr-lg-n6 focus-reset z-index-supper"
                data-dismiss="modal"><i class="lni lni-close"></i></button>
        <div class="login-modal-main">
          <div class="row no-gutters">
            <div class="col-12">
              <div class="row">
                <div class="heading">
                  <h3>登录</h3>
                  <!-- <p>Log in to continue your account <br> and explore new jobs.</p> -->
                  <p> 登录以继续您的账户并探索新的工作。</p>

                </div>
                <!-- <div class="social-login">
                  <ul>
                    <li><a class="linkedin" href="#"><i class="lni lni-linkedin-original"></i> Log in
                      with LinkedIn</a></li>
                    <li><a class="google" href="#"><i class="lni lni-google"></i> Log in with
                      Google</a></li>
                    <li><a class="facebook" href="#"><i class="lni lni-facebook-original"></i> Log in
                      with Facebook</a></li>
                  </ul>
                </div> -->
                <!-- <div class="or-devider">
                  <span>Or</span>
                </div> -->


                <form  id="loginform" onsubmit="return false">
                  <div class="form-group">
                    <!--邮箱-->
                    <!--<label for="email" class="label">E-mail</label>
                    <input type="email" class="form-control" placeholder="example@gmail.com" id="email">-->
                    <br>
                    <label for="phone" class="label">电话号码</label>
                    <div class="position-relative">
                      <input type="tel" class="form-control" id="phone"
                             name="loginphone"  placeholder="请输入电话号码" required>
                    </div>
                  </div>
                  <div class="form-group">
                    <label for="password" class="label">密码</label>
                    <div class="position-relative">
                      <input type="password" class="form-control" id="password"
                             name="loginpwd"   placeholder="请输入密码" required>
                    </div>
                  </div>

                  <div>

                    <!-- <input type="radio" name="loginrule" value="adminlogin" id="adminlogincheckbox" onclick="getloginroleradioval(this.value)" required/>
                     <label for="adminlogincheckbox" >我是管理员</label>-->

                    <input required type="radio" name="loginrule"  value="employeelogin" id="employeelogincheckbox" onclick="getloginroleradioval(this.value)"/>
                    <label for="employeelogincheckbox" >我是求职者</label>

                    <input  required type="radio" name="loginrule" value="hrlogin" id="hrlogincheckbox" onclick="getloginroleradioval(this.value)"/>
                    <label for="hrlogincheckbox" >我是招聘方</label>

                    <br>
                  </div>
                  <div class="form-group d-flex flex-wrap justify-content-between">
                    <!-- Default checkbox -->
                    <div class="form-check">
                      <input class="form-check-input" type="checkbox" value=""
                             id="flexCheckDefault" />
                      <label class="form-check-label" for="flexCheckDefault">记住密码</label>
                    </div>
                    <a href="" class="font-size-3 text-dodger line-height-reset">忘记密码</a>
                  </div>
                  <div class="form-group mb-8 button">
                    <button class="btn " onclick="login()">登录
                    </button>
                  </div>
                  <p class="text-center create-new-account">  没有账号? <a href="#">立刻创建账号 </a></p>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- End Login Modal -->

    <!-- Signup Modal -->
    <div class="modal fade form-modal" id="signup" tabindex="-1" aria-hidden="true">
      <div class="modal-dialog max-width-px-840 position-relative">
        <button type="button"
                class="circle-32 btn-reset bg-white pos-abs-tr mt-md-n6 mr-lg-n6 focus-reset z-index-supper"
                data-dismiss="modal"><i class="lni lni-close"></i></button>
        <div class="login-modal-main">
          <div class="row no-gutters">
            <div class="col-12">
              <div class="row">
                <div class="heading">
                  <h3>创建账户 </h3>
                  <!-- <p>Create your account to continue <br> and explore new jobs.</p> -->
                  <p>创建您的账户以继续并探索新的工作。</p>
                </div>
                <!-- <div class="social-login">
                  <ul>
                    <li><a class="linkedin" href="#"><i class="lni lni-linkedin-original"></i> Import from LinkedIn</a></li>
                    <li><a class="google" href="#"><i class="lni lni-google"></i> Import from
                      Google</a></li>
                    <li><a class="facebook" href="#"><i class="lni lni-facebook-original"></i> Import from Facebook</a></li>
                  </ul>
                </div>
                <div class="or-devider">
                  <span>Or</span>
                </div> -->
                <!--后端的Controller进行处理-->
                <form  id="signupform" onsubmit="return false">
                  <div class="form-group">
                    <br>
                    <label for="phone" class="label">电话号码</label>
                    <input type="tel" class="form-control" name="phone" placeholder="输入电话号码" required>
                  </div>
                  <div class="form-group">
                    <label for="inputpwd" class="label">密码</label>
                    <div class="position-relative">
                      <input name="pwd" type="password" class="form-control" id="inputpwd" placeholder="输入密码" onkeyup="checkpwd()" required>
                    </div>
                  </div>
                  <div class= "form-group" >
                    <label for="confirmpwd" class="label">确认密码</label>
                    <div class="position-relative">
                      <input name="repwd" type="password" class="form-control" id="confirmpwd" placeholder="确认密码" onkeyup="checkpwd()">
                      <span id="tishi"></span></input>
                    </div>
                  </div>
                  <div class= "form-group" >
                    <label for="signupname" class="label">您的姓名</label>
                    <div class="position-relative">
                      <input required name="signupname" type="text" class="form-control" id="signupname" placeholder="输入姓名">
                      </input>
                    </div>
                  </div>
                  <div class="form-group" id="signuprolegroup">
                    <label for="signuprolegroup" class="label">请选择注册身份</label>
                    <!--选择身份进行注册-->
                    <!--<input type="radio" name="signrule" value="adminsignup" id="adminsigncheckbox" onclick="getsignuproleradioval(this.value)"required/>
                    <label for="adminsigncheckbox" >管理员注册</label>-->

                    <input  type="radio" name="signrule"  value="employeesignup" id="employeesigncheckbox" onclick="getsignuproleradioval(this.value)"/>
                    <label for="employeesigncheckbox" >求职者注册</label>

                    <input   type="radio" name="signrule" value="hrsignup" id="hrsigncheckbox"onclick="getsignuproleradioval(this.value)"/>
                    <label for="hrsigncheckbox" >招聘方注册</label>
                  </div>

                  <!--隐藏元素，按需显现-->
                  <!--hr注册必填元素:公司和公司职位-->
                  <div class= "form-group hidden" id="hrsignupposclass">
                    <label for="hrsignuppos" class="label">您的职位</label>
                    <div class="position-relative">
                      <input name="hrpos" type="text" class="form-control" id="hrsignuppos" placeholder="输入职位">
                      </input>
                    </div>
                  </div>
                  <div class="form-group hidden" id="hrsignupcompanyclass">
                    <label for="hrsignupcompany" class="label">选择所在公司</label>
                    <select name="hrcompany" class="form-control" id="hrsignupcompany"></select>
                    <a href="company.html" id="hrcompanysignup">找不到所属公司请点击此处进行公司注册</a>
                  </div>
                  <!--hr必填元素结束-->
                  <!--求职者注册必填元素email,Gender,-->
                  <div class= "form-group hidden" id="seekersignemailclass">
                    <label for="seekersignemail" class="label">您的邮箱</label>
                    <div class="position-relative">
                      <input name="seekeremail" type="email" class="form-control" id="seekersignemail" placeholder="输入邮箱">
                      </input>
                    </div>
                  </div>
                  <div class= "form-group hidden" id="seekersigngenderclass">
                    <label for="seekersigngender" class="label">性别</label>
                    <div class="position-relative">
                      <select name="seekergender" class="form-control" id="seekersigngender">
                        <option value="女">女</option>
                        <option value="男">男</option>
                        <option value="未知">未知</option>
                      </select>
                    </div>
                  </div>
                  <div class= "form-group hidden" id="seekerdateclass">
                    <label for="seekersigndate" class="label">出生日期</label>
                    <div class="position-relative">
                      <input name="seekerdate" type="date" class="form-control" id="seekersigndate" placeholder="输入出生日期">
                      </input>
                    </div>
                  </div>
                  <div class= "form-group hidden" id="seekeriseduclass">
                    <label for="seekerisedu" class="label">是否为应届生</label>
                    <div class="position-relative">
                      <select name="seekerisedu" class="form-control" id="seekerisedu">
                        <option value="是">是</option>
                        <option value="否">否</option>
                      </select>

                    </div>
                  </div>
                  <!--求职者注册必填元素结束-->
                  <div class="form-group d-flex flex-wrap justify-content-between">
                    <!-- Default checkbox -->
                    <div class="form-check">
                      <input class="form-check-input" type="checkbox" value="" checked required>
                      <label class="form-check-label" for="flexCheckDefault">同意 <a
                        href="#">用户使用协议</a></label>
                    </div>
                  </div>

                  <div class="form-group mb-8 button">
                    <button class="btn " id="signupbtn" onclick="signup()" >注册
                    </button>
                  </div>
                </form>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- EndSignup Modal -->

                        <!-- Start Footer Area -->
<footer class="footer">
        <div class="footer-bottom">
            <div class="container">
                <div class="inner">
                    <div class="row">
                        <div class="col-lg-6 col-md-6 col-12">
                            <div class="left">
                                <p><a target="_blank" >软件工程大作业</a></p>
                            </div>
                        </div>
                        <div class="col-lg-6 col-md-6 col-12">
                            <div class="right">
                                <ul>
                                    <li><a href="privacy-policy.html">用户手册</a></li>
                                    <li><a href="#">项目文档</a></li>
                                    <li><a href="https://gitee.com/Yuan-Wi/software-engineering-team/tree/master/">gitee</a></li>
                                    <li><a href="contact.html">联系我们</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- End Footer Middle -->
    </footer>
    <!--/ End Footer Area -->

    <!-- ========================= scroll-top ========================= -->
    <a href="#" class="scroll-top btn-hover">
        <i class="lni lni-chevron-up"></i>
    </a>

    <!-- ========================= JS here ========================= -->
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>

    <script src="assets/js/wow.min.js"></script>
    <script src="assets/js/tiny-slider.js"></script>
    <script src="assets/js/glightbox.min.js"></script>
    <script src="assets/js/main.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>

    <script type="text/javascript">
      //===========表单数据传到后台

      function signup(){
        alert($('#postjobform').serialize());
        $.ajax({
          type: "POST",
          dataType: "json",
          url: "http://localhost:8080/jobpost",
          data: $('#postjobform').serialize(),
          success: function(result){
            if(result.code==200){
              alert("发布工作岗位成功，请等待管理员审核");
              /*页面重定向到首页*/
              window.location.href="http://localhost/frontindex";
            }
            else{
              alert(result.code);
            }
          },
          error : function(){
            alert("发布工作失败!");
          },
        });
      }
       //================注册登录相关
          //像后端传本地浏览器保存的token（当前登录用户）点击首页跳转的页面
    function checkloginuser(){
        //window.location.reload();

      $.ajax({
      url: "http://localhost:8080/mycheckloginuser",
      type: "GET",
      data: {token : window.localStorage.getItem("user")?window.localStorage.getItem("user"):"notoken"},
      success: function(result){
       // alert(result.code);
        if(result.code==200){
          if(result.msg=="hrlogin"){

          location.href="http://localhost/static/html/showhrinfo.html";
          }
          else if(result.msg=="employeelogin"){window.location.href="http://localhost/static/html/showseekerinfo.html";}
        }
        else {
          alert(result.code+result.msg);
          }
      },
      error: function(){
      alert("请刷新重试");
      },
    });

    };
  //其他业务请求从本地浏览器中存的token获取加入请求头

  function logout(){
   window.localStorage.removeItem('user');
   location.href="http://localhost/static/html/index.html";
  };
  var loginuserinfo;//当前登录用户的角色和id
  /*解析token*/
  function sparsetoken(){
  var token;
    $(function(){
    token = window.localStorage.getItem("user");//这可以得到当前登录用户的token
    alert("user="+token);
    alert(window.location.href);
    //data.data.normal_login_token为发送Ajax获取到的token信息
  var strings = token.split(".");//通过split()方法将token转为字符串数组
  //取strings[1]数组中的第二个字符进行解析
  var userinfo = JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, "+").replace(/_/g, "/")))));
  loginuserinfo = userinfo;//赋给全局变量
  //然后可以拿到解析后的数据，可以console.log()打印下，roleid是在表中的id，loginrole=hrlogin或seekerlogin
  alert(userinfo.roleid+userinfo.loginrole+'userinfo');

    });

  };



     //===========最初需要完成名字的显示
    $(document).ready(function(){


           /*   alert("新方法");*/
              $.ajax({
      url: "http://localhost:8080/mylogingetusername",
      type: "GET",
      data: {token : window.localStorage.getItem("user")?window.localStorage.getItem("user"):"notoken"},
      success: function(result){
       // alert(result.code);
        if(result.code==200){
        alert(result.msg);
        document.getElementById('shownameid').textContent = "欢迎"+result.msg+"登录";
        }
        else {
          alert(result.code+result.msg);
          }
      },
      error: function(){
      alert("请刷新重试");
      },
    });
          });


          let pageNum = 1;
          let pageSize = 10;
          let total = 0;
          function searchseeker(seekerPosition="",seekerInfo="",seekerEducation="",seekerAdvantage=""){
            token = window.localStorage.getItem("user");//这可以得到当前登录用户的token
            var strings = token.split(".");//通过split()方法将token转为字符串数组
            //取strings[1]数组中的第二个字符进行解析
            var userinfo = JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, "+").replace(/_/g, "/")))));
            //loginuserinfo = userinfo;//赋给全局变量
            //然后可以拿到解析后的数据，可以console.log()打印下，roleid是在表中的id，loginrole=hrlogin或seekerlogin
            alert(userinfo.roleid+userinfo.loginrole+'userinfo');


            var hrId =userinfo.roleid;
            alert(hrId+'hrId');

            if (isNaN(hrId)) {
              alert('请输入有效的HR ID');
              return;
            }


            var data = {
              hrId: hrId,
              seekerPosition:seekerPosition,
              seekerInfo:seekerInfo,
              seekerEducation:seekerEducation,
              seekerAdvantage:seekerAdvantage,
              pageNum: pageNum,
              pageSize: pageSize
            };

            // 输出到控制台（可选）


        $.ajax({
          url: 'http://localhost:8080/system/job_seeker_relation/listByhridandnotyet',
          type: 'get',
          data: data,
          dataType: 'json',
          headers: {
            'X-Requested-With': 'XMLHttpRequest'
          },
          success: function (res) {
            console.log(res);
            console.log("response ok for seekjobby hrid");
            var html = '';
            res.rows.forEach(function (item, index) {
              var seeker = item.seekerInfo;
              var relation = item.relationInfo;
              var job=item.jobinfo;
              html += ` <div class="resume-item">-->
                                <img src="assets/images/resume/candidate1.jpg" alt="Candidate">
                                <div class="right">
                                    <h3>
                                        <a href="resume.html?id=${seeker.seekerId}">${seeker.seekerName}</a>
                                    </h3>

                                    <ul class="experience">
                                        <li>姓名： <span>${seeker.seekerName} </span></li>
<!--                                        这里应该改成jobid的名称，但是返回的是另一个搜索了-->
                                        <li>申请职位： <span>${job.jobName} </span></li>
                                        <li>应届生： <span>${seeker.seekerIsfreshman} </span></li>
                                        <li>专业: <span>${seeker.seekerMaj} </span></li>
                                        <li>
                                            <i class="lni lni-map-marker"></i>
                                            <span>${seeker.seekerEdulvl} </span>，<span>${seeker.seekerSchname} </span>
                                        </li>
                                    </ul>
                                    <ul class="skills">
                                  <li>skiils: <span>${seeker.seekerAdv} </span></li>
                                    </ul>
                                    <div class="update-date">
                                        <p class="status">
                                            <strong>期望工作地点</strong> ${seeker.seekerExpworkloc}
                                        </p>
                                        <div class="action-btn">

            <button type="submit" class="btn approve-btn float-right" data-relationrId="${relation.relationId}">批准</button>
            <button type="submit" class="btn reject-btn float-right" data-relationrId="${relation.relationId}">拒绝</button>

                                        </div>
                                    </div>
                                </div>
                            </div>
                    `;


            });


            total = res.total;
            $('.jobnotyet-list').html(html);
            updatePagination();



// 批准按钮点击事件
            $('.approve-btn').click(function() {
             //var data=item.seekerAdv
              //var seekerId = $(this).data('seekerId');
              var relationid=$(this).attr('data-relationrId');
                        approve(relationid);
                });

                // 拒绝按钮点击事件
                $('.reject-btn').click(function() {
                  var relationid=$(this).attr('data-relationrId');
                  reject(relationid);
                });




              }
            });
          }

      //页面显示
      $(document).ready(function(){

        searchseeker();

      });

      $('#searchseeker').on('click', function() {
        // 点击按钮时调用 searchseeker 函数
        //console.log('执行搜索操作');
        // 获取申请职位的值
        var seekerPosition = $('#seekerdetailname').val();//jobid
        var seekerInfo = $('#seekerdetailinfo').val();
        var seekerEducation = $('#seekerdetailedu').val();
        var seekerAdvantage = $('#seekerdetailadv').val();



        searchseeker(seekerPosition,seekerInfo,seekerEducation,seekerAdvantage);
    });

    </script>

    <script>
      function approve(relationid){
        console.log("=======================================");  // 输出到控制台
        alert("Seeker ID for approve: " + relationid);  // 输出到控制台
        $.ajax({
          url: 'http://localhost:8080/system/job_seeker_relation/approve',
          type: 'POST',
          data:  { relationId: relationid },
          dataType: 'json',
          headers: {
            'X-Requested-With': 'XMLHttpRequest'
          },
          success: function(res) {
            if (res.success) {
              alert('已批准');
              // 你可以在这里刷新页面或移除相应的简历项
            } else {
              alert('已批准');
              location.reload();
              //alert('relationid:'+relationid+'批准失败');
              // console.log(seekerid);
              // alert(res.code);
              // alert('批准失败');
            }
          },
          error: function() {
            alert('请求失败');
          }
        });
      }
      function reject(relationid){
        console.log("=======================================");  // 输出到控制台
        console.log("Seeker ID for reject: " + relationid);  // 输出到控制台
        $.ajax({
          url: 'http://localhost:8080/system/job_seeker_relation/reject',
          type: 'post',
          data: { relationId: relationid },
          dataType: 'json',
          headers: {
            'X-Requested-With': 'XMLHttpRequest'
          },
          success: function(res) {
            if (res.success) {
              alert('已拒绝');
              location.reload();
              // 你可以在这里刷新页面或移除相应的简历项
            } else {
              //alert('拒绝失败');
              alert('已拒绝');
            }
          },
          error: function() {
            alert('请求失败');
          }
        });
      }

      function getHrJobList(hrId){
        var data = {
            hrId: hrId
        };
        $.ajax({
            url: 'http://localhost:8080/system/job/listByhrid',
            type: 'GET',
            data: data,
            dataType: 'json',
            headers: {
                'X-Requested-With': 'XMLHttpRequest'
            },
            success: function(res) {
                console.log(res);
                var options = '<option value="">全部</option>'; // 默认选项
                res.rows.forEach(function(item) {
                    options += '<option value="' + item.jobId + '">' + item.jobName + '</option>';
                });
                $('#seekerdetailname').html(options);
            },
            error: function(error) {
                console.error("Error fetching job list:", error);
            }
        });
    }

    $(document).ready(function() {
      //获取hrid
        token = window.localStorage.getItem("user");//这可以得到当前登录用户的token
        var strings = token.split(".");//通过split()方法将token转为字符串数组
        var userinfo = JSON.parse(decodeURIComponent(escape(window.atob(strings[1].replace(/-/g, "+").replace(/_/g, "/")))));
        var hrId =userinfo.roleid;
        //获取工作列表
        getHrJobList(hrId);
    });
    function updatePagination() {
      const totalPages = Math.ceil(total / pageSize);
      let paginationHtml = '';

      paginationHtml += `<li><a href="#" id="prev-page"><i class="lni lni-arrow-left"></i></a></li>`;

      for (let i = 1; i <= totalPages; i++) {
          paginationHtml += `<li class="${i === pageNum ? 'active' : ''}"><a href="#" class="page-number" data-page="${i}">${i}</a></li>`;
      }

      paginationHtml += `<li><a href="#" id="next-page"><i class="lni lni-arrow-right"></i></a></li>`;

      $('.pagination-list').html(paginationHtml);

      // Disable previous button if on the first page
      if (pageNum <= 1) {
          $('#prev-page').parent().addClass('disabled');
      } else {
          $('#prev-page').parent().removeClass('disabled');
      }

      // Disable next button if on the last page
      if (pageNum >= totalPages) {
          $('#next-page').parent().addClass('disabled');
      } else {
          $('#next-page').parent().removeClass('disabled');
      }
  }
    </script>
</body>

</html>
